<?php
class Controller extends Controller_Core {


	protected $is_ie = 0;
	protected $is_gb = FALSE; // GoogleBot

	public function __construct(){
		parent::__construct();



		if(!empty($_SERVER['HTTP_USER_AGENT'])) {
			$match = array();
			$u_agent = $_SERVER['HTTP_USER_AGENT'];
			if(preg_match('/MSIE (\d+)/i', $u_agent, $match)) {
				$this->is_ie = $match[1];
			} else if(strpos($u_agent, 'Googlebot')) {
				$this->is_gb = TRUE;
			}
		}
	}

	protected function _setGlobals($view) {

		$view->set_global('images','media/'.Kohana::lang('global.lang').'/images/');
		$view->set_global('js','media/js/');
		$view->set_global('css','media/'.Kohana::lang('global.lang').'/css/');
		$view->set_global('is_ie',$this->is_ie);
		$view->set_global('is_gb',$this->is_gb);


		$view->set_global('jquery','media/libraries/jquery-1.8.2.js');
		$view->set_global('ui_js','media/libraries/jquery-ui-1.9.1.custom.js');
		$view->set_global('ui_css','media/libraries/css/jquery-ui-1.9.1.custom.css');
		$view->set_global('js','media/js/script.js?v=1.0.1');

		$view->set_global('load_css',array('style_all.css?v=1.0.1'));
		$view->set_global('load_iecss',array('ie.css?v=1.0.1'));
		$view->set_global('load_ie6css',array('ie6.css?v=1.0.1'));
		

	}
}